package com.superdaxue.rxsampledemo.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.superdaxue.rxsampledemo.R;
import com.superdaxue.rxsampledemo.bean.DataBean;
import com.superdaxue.rxsampledemo.utils.BaseRecyclerAdapter;
import com.superdaxue.rxsampledemo.utils.RecyclerHolder;


/**
 * Created by ZX_CC on 2016/5/5.
 */
public class RvAdapter extends BaseRecyclerAdapter<DataBean.ShowapiResBodyBean.NewslistBean> {
    private Context context;
    public RvAdapter(RecyclerView rv, int mLayoutItemId) {
        super(rv, mLayoutItemId);
        this.context = rv.getContext();
    }

    @Override
    public void bindViewData(RecyclerHolder holder, DataBean.ShowapiResBodyBean.NewslistBean item, int position, boolean isScrolling) {
        holder.setText(R.id.tv_item_img_fragment,item.getTitle());
        ImageView iv = holder.getView(R.id.iv_item_img_fragment);
        Glide.with(context).load(item.getPicUrl()).into(iv);
    }
}
